const { API_HOST } = require("../../../config");

// pages/questionaire/sharequestionnaire/sharequestionnaire.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    questitle:"",
    splid:"",
    copyUrl:"",
    introduce:""
  },
  copyLink: function() {
    wx.setClipboardData({
      data: this.data.copyUrl,
      success() {
        wx.showToast({
          title: '复制链接成功，赶紧打开填写资料吧',
          duration:3000,
          icon:"none"
        })
      }
    })
  },
  toCreatePoster: function() {
    wx.navigateTo({
      // url: `/pages/questionaire/sharequestionnaire/createposter/createposter?splid=${this.data.splid}&questitle=${this.data.questitle}&introduce=${this.data.introduce}`,
      url: `/pages/questionaire/sharequestionnaire/createposter/createposter?splid=${this.data.splid}`,
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
 
    this.setData({
      questitle:options.questitle,
      splid:options.splid,
      introduce:options.introduce,
      // copyUrl:`${API_HOST}hm-course/#/questionnaire?splid=${options.splid}&questitle=${encodeURI(options.questitle)}&introduce=${encodeURI(options.introduce)}`
      copyUrl:`${API_HOST}hm-course/#/questionnaire?splid=${options.splid}`
    })
 
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})